<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;

/**
 * Class MessageProduct
 *
 * @property int $id
 * @property string|null $name
 * @property int|null $count
 * @property double|null $price
 * @property int|null $product_class
 * @property int|null $product_status
 * @property Carbon|null $create_time
 * @property Carbon|null $update_time
 *
 * @property Collection|TopUp[] $top_ups
 *
 * @package App\Models
 */
class MessageProduct extends Model
{
    protected $connection = 'mysql_sms';
	protected $table = 'message_product';

	protected $casts = [
		'count' => 'int',
		'price' => 'double',
		'product_class' => 'int',
		'product_status' => 'int'
	];

	protected $fillable = [
		'name',
		'count',
		'price',
		'product_class',
		'product_status'
	];

	public function top_ups()
	{
		return $this->hasMany(TopUp::class, 'product_id');
	}
}
